package edu.fjnu.seed.controller;
import java.util.Scanner;
public class SolarSystem01
{
    public static void main(String Args[])
    {
        float Standard_power,Discount,Discount_part,Sum;
        int Year,Work_year,Continue=1;
        Scanner Power = new Scanner(System.in);
        while(Continue == 1)
        {
            Sum=0;
            System.out.println("请输入标准年产电量(/kWh)：");
            Standard_power=Power.nextFloat();
            System.out.println("请输入光伏组件正常工作年限(/年)：");
            Work_year = Power.nextInt();
            System.out.println("请以小数方式输入光伏组件在"+Work_year+"年中的累计折减比例：");
            Discount = Power.nextFloat();
            while(Discount>1||Discount<0)
            {
                System.out.println("输入有误，请重新输入区间为[0,1]的值:");
                Discount = Power.nextFloat();
            }
            Discount_part = (float) (Discount/Work_year);
            for(Year=1;Year<Work_year+1;Year++)
            {
                Sum= (float) (Sum+Standard_power*(1.0-Year*Discount_part));
            }
            System.out.println(Work_year+"年的累计产电量为："+Sum+"kWh");
            System.out.println("是否继续？是：1 否：2");
            Continue = Power.nextInt();
            while(Continue!=1&Continue!=2)
            {
                System.out.println("输入有误，请重新选择是否继续：是：1；否：2；");
                Continue = Power.nextInt();
            }
        }
    }
}
